
#ifndef DIMENSION_H_
#define DIMENSION_H_

template <class T1,class T2>
class Dimension
{
	typedef Dimension<T1,T2> self;
public:
	Dimension(T1 amount,T2* unit);
	//Dimension(self &a);

	bool operator==(const self &a) const;
	bool operator!=(const self  &a) const;
	self operator+(const self &a) const;
private:
	T1 amount;
	T2* unit;
};

template<class T1,class T2>
Dimension<T1,T2>::Dimension(T1 amount,T2* unit)
:amount(amount),
unit(unit)
{

}

template<class T1,class T2>
bool Dimension<T1,T2>::operator==(Dimension<T1,T2> const &a) const
{
	return (amount*unit->getFactor() == a.amount*a.unit->getFactor());
}

template<class T1,class T2>
bool Dimension<T1,T2>::operator!=(Dimension<T1,T2> const &a) const
{
	return !(*this == a);
}

template<class T1,class T2>
Dimension<T1,T2> Dimension<T1,T2>::operator+(Dimension<T1,T2> const &a) const
{

	 T1 tempAmount = this->amount*unit->getFactor() + a.amount*a.unit->getFactor();
	 Dimension<T1,T2> temp(tempAmount/this->unit->getFactor(),this->unit);

	 return temp;
}

#endif

